package com.leiyu.control

import com.jfinal.captcha.{Captcha, CaptchaRender}
import com.jfinal.core.Controller
import com.leiyu.model.User

/**
  * Created by LeiYu on 2017/6/26.
  */
class IndexControl extends Controller {
  /**
    * 主界面控制器
    */
  private  val msg:String="";//验证码信息
  def index(): Unit = {
    render("/Index.html")
  }

  def test(): Unit = {
    val user = new User
    user.setAge(20)
    user.setName("黎明")
    user.setId(1)
    user.setAddress("北京")
    println(user)
    setAttr("user",user)
    //setAttr("user","Hello")
    this.renderFreeMarker("/hello.ftl")
  }


  def code(): Unit ={
      val render = new CaptchaRender()
      CaptchaRender.validate(this,"")
      this.render(render)
  }

  def login(): Unit ={

    val name = this.getPara("name")
    val pwd = this.getPara("password")

    renderJson(0)

  }

}
